package com.zdj.question;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @author zhangdj
 * @date 2022-08-29
 */
public class Question3Test {

    public static void main(String[] args) {
//        int money = Integer.parseInt(args[0]);
//        int year = Integer.parseInt(args[1]);
        solution(987654321, 2);
    }

    /**
     * @param money 本金
     * @param year 年限
     */
    public static void solution(int money, int year) {
        // 本息和
        double outMoney = 0;
        // 根据利率和年限计算本息和
        if (year == 1) {
            outMoney = money + money * 2.25 / 100 * 1;
        } else if (year == 2) {
            outMoney = money + money * 2.7 / 100 * 2;
        } else if (year == 3) {
            outMoney = money + money * 3.25 / 100 * 3;
        } else if (year == 5) {
            outMoney = money + money * 3.6 / 100 * 5;
        } else {
            System.out.print("输入的年限有误");
        }
        //5.打印输出
        System.out.print("存款" + year + "年后的本息是：" + BigDecimal.valueOf(outMoney).setScale(2, RoundingMode.HALF_UP));
    }
}
